package com.xmxsuperstar.app.ttac.thread;

import java.util.List;

import android.content.Context;
import android.os.Handler;
import android.widget.ListView;

import com.xmxsuperstar.app.ttac.StatusListAdapter;
import com.xmxsuperstar.app.ttac.collections.FList;
import com.xmxsuperstar.app.ttc.client.TwitterTimeLineClient;
import com.xmxsuperstar.app.ttc.client.model.TwitterStatus;

public class TimeLineMoreThread extends TimeLineThread {

	public TimeLineMoreThread(Context context, ListView lv,
			Handler headImageHandler, Handler timeLineHandler,
			TwitterTimeLineClient tc) {
		super(context, lv, headImageHandler, timeLineHandler, tc);
	}

	@Override
	public void getData() {
		FList<TwitterStatus> statusList = ((StatusListAdapter) lv.getAdapter())
				.getstatusList();
		long maxId = statusList.get(statusList.size() - 1).getId();
		List<TwitterStatus> timeLineByMaxIdList = tc.getTimeLineByMaxId(maxId,
				20);

		if (timeLineByMaxIdList.size() >= 1) {
			for (int i = 1; i < timeLineByMaxIdList.size(); i++) {
				statusList.append(timeLineByMaxIdList.get(i));
			}
		}

	}

}
